#include "testGui.h"

void TestGui::testGui()
{
	QLineEdit lineEdit;
	QTest::keyClicks(&lineEdit, "hello world");
	QCOMPARE(lineEdit.text(), QString("hello world"));
} 

void TestGui::testGuiD_data()
{
	QTest::addColumn<QTestEventList>("events");
	QTest::addColumn<QString>("expected");

	QTestEventList list1;
	list1.addKeyClick('a');
	QTest::newRow("char") << list1 << "a";

	QTestEventList list2;
	list2.addKeyClick('a');
	list2.addKeyClick(Qt::Key_Backspace);
	QTest::newRow("there and back again") << list2 << "";
} 

void TestGui::testGuiD()
{
	QFETCH(QTestEventList, events);
	QFETCH(QString, expected);
	QLineEdit lineEdit;
	events.simulate(&lineEdit);
	QCOMPARE(lineEdit.text(), expected);
}

QTEST_MAIN(TestGui)
